package com.manulife.hk.performance.model;

import java.time.LocalDate;

import javax.validation.constraints.Digits;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;

import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.math.BigDecimal;

@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class IssueSale {

	private Long id;
	@NotNull
	@Size(max = 20)
	private String issueSalesKey;

	@NotNull
	private LocalDate dprDate;
	/**
	 * Get agentCode
	 * 
	 * @return agentCode
	 **/
	@ApiModelProperty(example = "311781", required = true, value = "")
	@NotNull
	@Size(min = 6, max = 6)
	private String agentCode;
	@NotNull
	@Size(max = 3)
	private String sysCode;

	/**
	 * Gets or Sets lob
	 */
	public enum LobEnum {
		IND("IND"),

		WM("WM"),

		MAM("MAM"),

		GP("GP"),

		GI("GI"),

		GLH("GLH"),

		CRC("CRC");

		private String value;

		LobEnum(String value) {
			this.value = value;
		}

		@Override
		@JsonValue
		public String toString() {
			return String.valueOf(value);
		}

		@JsonCreator
		public static LobEnum fromValue(String text) {
			for (LobEnum b : LobEnum.values()) {
				if (String.valueOf(b.value).equals(text)) {
					return b;
				}
			}
			return null;
		}
	}

	@NotNull
	private LobEnum lob;
	@NotNull
	@Size(max = 2)
	private String pType;

	@NotNull
	@Size(max = 20)
	private String contractNum;

	@Size(max = 10)
	private String subGroupNum;

	@Size(max = 10)
	private String certificateNum;

	@Size(max = 20)
	private String basicPlanCode;

	@Size(max = 2)
	private String basicPlanVersNum;

	@Size(max = 20)
	private String coverageLayerPlanCode;

	@Size(max = 2)
	private String coverageLayerVersNum;

	@Size(max = 1)
	private String coverageLayerType;

	@Size(max = 10)
	private String policyPlanType;

	@Size(max = 30)
	private String appInKey;

	@NotNull
	@Size(max = 3)
	private String reasonCode;

	@NotNull
	@Size(max = 50)
	private String reasonCodeDesc;

	@NotNull
	@Size(max = 1)
	private String coreIndicator;

	@NotNull
	@Size(max = 1)
	private String isAgentOwn;

	@NotNull
	@Size(max = 1)
	private String isAdjustmentSales;

	@NotNull
	@Digits(integer = 11, fraction = 0)
	private BigDecimal issuePc;

	@NotNull
	@Digits(integer = 3, fraction = 2)
	private BigDecimal issueCaseCount;

	@Size(max = 101)
	private String policyOwnerName;

	@Size(max = 101)
	private String policyInsuredName;

	@Size(max = 250)
	private String basicPlanNameEng;

	@Size(max = 250)
	private String basicPlanNameChi;

	@Size(max = 250)
	private String coveragePlanNameEng;

	@Size(max = 250)
	private String coveragePlanNameChi;

	private String lastUpdateUser;

	private LocalDate layerEffectiveDate;

}
